home *** CD-ROM | disk | FTP | other *** search
- //******************************************************************'
- //* *'
- //* TurboCAD for Windows *'
- //* Copyright (c) 1993 - 2004 *'
- //* International Microcomputer Software, Inc. *'
- //* (IMSI) *'
- //* All rights reserved. *'
- //* *'
- //******************************************************************'
-
- using System;
- using System.Drawing;
- using System.Collections;
- using System.ComponentModel;
- using System.Windows.Forms;
- using System.Data;
- using GXMPSLib;
- using GXRendersLib;
- //using IMSIGX;
- namespace TCADClientTest
- {
- /// <summary>
- /// Summary description for Form1.
- /// </summary>
-
- public class frmMain : System.Windows.Forms.Form
- {
- private System.Windows.Forms.StatusBar statusBar1;
- private System.Windows.Forms.MainMenu mainMenu1;
- private System.Windows.Forms.MenuItem menuItem1;
- private System.Windows.Forms.MenuItem menuItem2;
- private System.Windows.Forms.MenuItem menuItem3;
- private System.Windows.Forms.MenuItem menuItem16;
- private System.Windows.Forms.OpenFileDialog openFileDialog1;
- System.Windows.Forms.TabControl tabControl1;
- private System.ComponentModel.IContainer components;
- private System.Windows.Forms.MenuItem mnu_OpenFile;
- private System.Windows.Forms.ToolBar tbMain;
- private System.Windows.Forms.ToolBarButton tbbViewPlan;
- private System.Windows.Forms.ToolBarButton tbbVewBottom;
- private System.Windows.Forms.ToolBarButton tbbViewFront;
- private System.Windows.Forms.ToolBarButton tbbViewLeft;
- private System.Windows.Forms.ToolBarButton tbbViewRight;
- private System.Windows.Forms.ToolBarButton tbbViewISO_NE;
- private System.Windows.Forms.ToolBarButton tbbViewISO_SE;
- private System.Windows.Forms.ToolBarButton tbbViewISO_NW;
- private System.Windows.Forms.ToolBarButton tbbViewISO_SW;
- private System.Windows.Forms.ImageList imageList1;
- private System.Windows.Forms.MenuItem mnu_FileExit;
- private System.Windows.Forms.MenuItem mnuZoomIn;
- private System.Windows.Forms.MenuItem mnuZoomOut;
- private System.Windows.Forms.HScrollBar hSBar;
- private System.Windows.Forms.VScrollBar vSBar;
- private System.Windows.Forms.MenuItem mnu_CloseFile;
- private System.Windows.Forms.MenuItem mnu_Select;
- private System.Windows.Forms.MenuItem mnu_SelectAll;
- private System.Windows.Forms.MenuItem mnu_Camera;
- private System.Windows.Forms.MenuItem mnu_CameraTop;
- private System.Windows.Forms.MenuItem mnu_CameraLeft;
- private System.Windows.Forms.MenuItem mnu_CameraRight;
- private System.Windows.Forms.MenuItem mnu_CameraFront;
- private System.Windows.Forms.MenuItem mnu_CameraBack;
- private System.Windows.Forms.MenuItem mnu_CameraISO_SE;
- private System.Windows.Forms.MenuItem mnu_CameraISO_NE;
- private System.Windows.Forms.MenuItem mnu_CameraISO_SW;
- private System.Windows.Forms.MenuItem mnu_CameraProperties;
- private System.Windows.Forms.MenuItem mnu_CameraISO_NW;
- private System.Windows.Forms.MenuItem mnu_ZoomToExtents;
- private System.Windows.Forms.MenuItem mnu_Refresh;
- TCADApp tcApp = null;
- public frmMain()
- {
- //
- // Required for Windows Form Designer support
- //
- InitializeComponent();
- if (tcApp == null)
- {
- //TCADApp tcApp1;
- tcApp = new TCADApp ();
- //this.tcApp = tcApp;
- }
- tcApp.InitTCApp ();
-
- //
- // TODO: Add any constructor code after InitializeComponent call
- //
- ControlsEnabler();
- MyResize();
-
- // tcApp = null;
- }
-
- /// <summary>
- /// Clean up any resources being used.
- /// </summary>
- protected override void Dispose( bool disposing )
- {
- if( disposing )
- {
- if (components != null)
- {
- components.Dispose();
- }
- }
-
- if (tcApp != null)
- {
- // delete tcApp.TCADApplicatiom
- }
- base.Dispose( disposing );
- }
-
- #region Windows Form Designer generated code
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmMain));
- System.Configuration.AppSettingsReader configurationAppSettings = new System.Configuration.AppSettingsReader();
- this.tbMain = new System.Windows.Forms.ToolBar();
- this.tbbViewPlan = new System.Windows.Forms.ToolBarButton();
- this.tbbViewLeft = new System.Windows.Forms.ToolBarButton();
- this.tbbViewFront = new System.Windows.Forms.ToolBarButton();
- this.tbbViewRight = new System.Windows.Forms.ToolBarButton();
- this.tbbVewBottom = new System.Windows.Forms.ToolBarButton();
- this.tbbViewISO_SE = new System.Windows.Forms.ToolBarButton();
- this.tbbViewISO_SW = new System.Windows.Forms.ToolBarButton();
- this.tbbViewISO_NE = new System.Windows.Forms.ToolBarButton();
- this.tbbViewISO_NW = new System.Windows.Forms.ToolBarButton();
- this.imageList1 = new System.Windows.Forms.ImageList(this.components);
- this.statusBar1 = new System.Windows.Forms.StatusBar();
- this.mainMenu1 = new System.Windows.Forms.MainMenu();
- this.menuItem1 = new System.Windows.Forms.MenuItem();
- this.mnu_OpenFile = new System.Windows.Forms.MenuItem();
- this.mnu_CloseFile = new System.Windows.Forms.MenuItem();
- this.menuItem16 = new System.Windows.Forms.MenuItem();
- this.mnu_FileExit = new System.Windows.Forms.MenuItem();
- this.menuItem2 = new System.Windows.Forms.MenuItem();
- this.mnu_Select = new System.Windows.Forms.MenuItem();
- this.mnu_SelectAll = new System.Windows.Forms.MenuItem();
- this.menuItem3 = new System.Windows.Forms.MenuItem();
- this.mnu_Camera = new System.Windows.Forms.MenuItem();
- this.mnu_CameraTop = new System.Windows.Forms.MenuItem();
- this.mnu_CameraLeft = new System.Windows.Forms.MenuItem();
- this.mnu_CameraRight = new System.Windows.Forms.MenuItem();
- this.mnu_CameraFront = new System.Windows.Forms.MenuItem();
- this.mnu_CameraBack = new System.Windows.Forms.MenuItem();
- this.mnu_CameraISO_SE = new System.Windows.Forms.MenuItem();
- this.mnu_CameraISO_SW = new System.Windows.Forms.MenuItem();
- this.mnu_CameraISO_NE = new System.Windows.Forms.MenuItem();
- this.mnu_CameraISO_NW = new System.Windows.Forms.MenuItem();
- this.mnu_CameraProperties = new System.Windows.Forms.MenuItem();
- this.mnuZoomIn = new System.Windows.Forms.MenuItem();
- this.mnuZoomOut = new System.Windows.Forms.MenuItem();
- this.mnu_ZoomToExtents = new System.Windows.Forms.MenuItem();
- this.mnu_Refresh = new System.Windows.Forms.MenuItem();
- this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
- this.tabControl1 = new System.Windows.Forms.TabControl();
- this.hSBar = new System.Windows.Forms.HScrollBar();
- this.vSBar = new System.Windows.Forms.VScrollBar();
- this.SuspendLayout();
- //
- // tbMain
- //
- this.tbMain.Appearance = System.Windows.Forms.ToolBarAppearance.Flat;
- this.tbMain.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.tbMain.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {
- this.tbbViewPlan,
- this.tbbViewLeft,
- this.tbbViewFront,
- this.tbbViewRight,
- this.tbbVewBottom,
- this.tbbViewISO_SE,
- this.tbbViewISO_SW,
- this.tbbViewISO_NE,
- this.tbbViewISO_NW});
- this.tbMain.DropDownArrows = true;
- this.tbMain.ImageList = this.imageList1;
- this.tbMain.Location = new System.Drawing.Point(0, 0);
- this.tbMain.Name = "tbMain";
- this.tbMain.ShowToolTips = true;
- this.tbMain.Size = new System.Drawing.Size(648, 29);
- this.tbMain.TabIndex = 0;
- this.tbMain.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.tbMain_ButtonClick);
- //
- // tbbViewPlan
- //
- this.tbbViewPlan.ImageIndex = 0;
- this.tbbViewPlan.ToolTipText = "World Plan";
- //
- // tbbViewLeft
- //
- this.tbbViewLeft.ImageIndex = 1;
- //
- // tbbViewFront
- //
- this.tbbViewFront.ImageIndex = 2;
- //
- // tbbViewRight
- //
- this.tbbViewRight.ImageIndex = 3;
- //
- // tbbVewBottom
- //
- this.tbbVewBottom.ImageIndex = 4;
- //
- // tbbViewISO_SE
- //
- this.tbbViewISO_SE.ImageIndex = 5;
- //
- // tbbViewISO_SW
- //
- this.tbbViewISO_SW.ImageIndex = 6;
- //
- // tbbViewISO_NE
- //
- this.tbbViewISO_NE.ImageIndex = 7;
- //
- // tbbViewISO_NW
- //
- this.tbbViewISO_NW.ImageIndex = 8;
- //
- // imageList1
- //
- this.imageList1.ImageSize = new System.Drawing.Size(16, 16);
- this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
- this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
- //
- // statusBar1
- //
- this.statusBar1.Location = new System.Drawing.Point(0, 321);
- this.statusBar1.Name = "statusBar1";
- this.statusBar1.Size = new System.Drawing.Size(648, 16);
- this.statusBar1.TabIndex = 1;
- this.statusBar1.TabStop = true;
- //
- // mainMenu1
- //
- this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
- this.menuItem1,
- this.menuItem2,
- this.menuItem3});
- //
- // menuItem1
- //
- this.menuItem1.Index = 0;
- this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
- this.mnu_OpenFile,
- this.mnu_CloseFile,
- this.menuItem16,
- this.mnu_FileExit});
- this.menuItem1.Text = "&File";
- //
- // mnu_OpenFile
- //
- this.mnu_OpenFile.Index = 0;
- this.mnu_OpenFile.Text = "&Open";
- this.mnu_OpenFile.Click += new System.EventHandler(this.mnuOpenFile_Click);
- //
- // mnu_CloseFile
- //
- this.mnu_CloseFile.Index = 1;
- this.mnu_CloseFile.Text = "&Close";
- //
- // menuItem16
- //
- this.menuItem16.Index = 2;
- this.menuItem16.Text = "&Print Preview";
- //
- // mnu_FileExit
- //
- this.mnu_FileExit.Index = 3;
- this.mnu_FileExit.Shortcut = System.Windows.Forms.Shortcut.AltF4;
- this.mnu_FileExit.Text = "&Exit";
- this.mnu_FileExit.Click += new System.EventHandler(this.mnu_FileExit_Click);
- //
- // menuItem2
- //
- this.menuItem2.Index = 1;
- this.menuItem2.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
- this.mnu_Select,
- this.mnu_SelectAll});
- this.menuItem2.Text = "&Edit";
- //
- // mnu_Select
- //
- this.mnu_Select.Index = 0;
- this.mnu_Select.Text = "&Select";
- //
- // mnu_SelectAll
- //
- this.mnu_SelectAll.Index = 1;
- this.mnu_SelectAll.Text = "&Select All";
- //
- // menuItem3
- //
- this.menuItem3.Index = 2;
- this.menuItem3.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
- this.mnu_Camera,
- this.mnuZoomIn,
- this.mnuZoomOut,
- this.mnu_ZoomToExtents,
- this.mnu_Refresh});
- this.menuItem3.Text = "View";
- //
- // mnu_Camera
- //
- this.mnu_Camera.Index = 0;
- this.mnu_Camera.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
- this.mnu_CameraTop,
- this.mnu_CameraLeft,
- this.mnu_CameraRight,
- this.mnu_CameraFront,
- this.mnu_CameraBack,
- this.mnu_CameraISO_SE,
- this.mnu_CameraISO_SW,
- this.mnu_CameraISO_NE,
- this.mnu_CameraISO_NW,
- this.mnu_CameraProperties});
- this.mnu_Camera.Text = "&Camera";
- //
- // mnu_CameraTop
- //
- this.mnu_CameraTop.Index = 0;
- this.mnu_CameraTop.Text = "&Top";
- //
- // mnu_CameraLeft
- //
- this.mnu_CameraLeft.Index = 1;
- this.mnu_CameraLeft.Text = "&Left";
- //
- // mnu_CameraRight
- //
- this.mnu_CameraRight.Index = 2;
- this.mnu_CameraRight.Text = "&Right";
- //
- // mnu_CameraFront
- //
- this.mnu_CameraFront.Index = 3;
- this.mnu_CameraFront.Text = "&Front";
- //
- // mnu_CameraBack
- //
- this.mnu_CameraBack.Index = 4;
- this.mnu_CameraBack.Text = "&Back";
- //
- // mnu_CameraISO_SE
- //
- this.mnu_CameraISO_SE.Index = 5;
- this.mnu_CameraISO_SE.Text = "ISO_SE";
- this.mnu_CameraISO_SE.Click += new System.EventHandler(this.mnuCameraISO_SE_Click);
- //
- // mnu_CameraISO_SW
- //
- this.mnu_CameraISO_SW.Index = 6;
- this.mnu_CameraISO_SW.Text = "ISO_SW";
- //
- // mnu_CameraISO_NE
- //
- this.mnu_CameraISO_NE.Index = 7;
- this.mnu_CameraISO_NE.Text = "ISO_NE";
- //
- // mnu_CameraISO_NW
- //
- this.mnu_CameraISO_NW.Index = 8;
- this.mnu_CameraISO_NW.Text = "ISO_NW";
- //
- // mnu_CameraProperties
- //
- this.mnu_CameraProperties.Index = 9;
- this.mnu_CameraProperties.Text = "&Properties";
- this.mnu_CameraProperties.Click += new System.EventHandler(this.mnu_CameraProperties_Click);
- //
- // mnuZoomIn
- //
- this.mnuZoomIn.Index = 1;
- this.mnuZoomIn.Shortcut = System.Windows.Forms.Shortcut.F3;
- this.mnuZoomIn.Text = "Zoom &In";
- this.mnuZoomIn.Click += new System.EventHandler(this.mnuZoomIn_Click);
- //
- // mnuZoomOut
- //
- this.mnuZoomOut.Index = 2;
- this.mnuZoomOut.Shortcut = System.Windows.Forms.Shortcut.F4;
- this.mnuZoomOut.Text = "Zoom &Out";
- this.mnuZoomOut.Click += new System.EventHandler(this.mnuZoomOut_Click);
- //
- // mnu_ZoomToExtents
- //
- this.mnu_ZoomToExtents.Index = 3;
- this.mnu_ZoomToExtents.Text = "&Zoom To Extents";
- this.mnu_ZoomToExtents.Click += new System.EventHandler(this.mnu_ZoomToExtents_Click);
- //
- // mnu_Refresh
- //
- this.mnu_Refresh.Index = 4;
- this.mnu_Refresh.Shortcut = System.Windows.Forms.Shortcut.F5;
- this.mnu_Refresh.Text = "&Refresh";
- this.mnu_Refresh.Click += new System.EventHandler(this.mnu_Refresh_Click);
- //
- // tabControl1
- //
- this.tabControl1.AccessibleRole = System.Windows.Forms.AccessibleRole.Document;
- this.tabControl1.Alignment = System.Windows.Forms.TabAlignment.Bottom;
- this.tabControl1.CausesValidation = false;
- this.tabControl1.HotTrack = true;
- this.tabControl1.ItemSize = new System.Drawing.Size(0, 14);
- this.tabControl1.Location = new System.Drawing.Point(0, 56);
- this.tabControl1.Multiline = true;
- this.tabControl1.Name = "tabControl1";
- this.tabControl1.SelectedIndex = 0;
- this.tabControl1.ShowToolTips = ((bool)(configurationAppSettings.GetValue("tabControl1.ShowToolTips", typeof(bool))));
- this.tabControl1.Size = new System.Drawing.Size(608, 216);
- this.tabControl1.TabIndex = 6;
- this.tabControl1.SelectedIndexChanged += new System.EventHandler(this.tabControl1_SelectedIndexChanged);
- //
- // hSBar
- //
- this.hSBar.LargeChange = 160;
- this.hSBar.Location = new System.Drawing.Point(264, 312);
- this.hSBar.Maximum = 16000;
- this.hSBar.Name = "hSBar";
- this.hSBar.Size = new System.Drawing.Size(344, 16);
- this.hSBar.SmallChange = 16;
- this.hSBar.TabIndex = 8;
- this.hSBar.Value = 8000;
- this.hSBar.Visible = false;
- this.hSBar.Scroll += new System.Windows.Forms.ScrollEventHandler(this.hSBar_Scroll);
- //
- // vSBar
- //
- this.vSBar.LargeChange = 160;
- this.vSBar.Location = new System.Drawing.Point(608, 56);
- this.vSBar.Maximum = 16000;
- this.vSBar.Name = "vSBar";
- this.vSBar.Size = new System.Drawing.Size(16, 208);
- this.vSBar.SmallChange = 16;
- this.vSBar.TabIndex = 9;
- this.vSBar.Value = 8000;
- this.vSBar.Visible = false;
- this.vSBar.Scroll += new System.Windows.Forms.ScrollEventHandler(this.vSBar_Scroll);
- //
- // frmMain
- //
- this.AccessibleRole = System.Windows.Forms.AccessibleRole.Application;
- this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
- this.AutoScroll = ((bool)(configurationAppSettings.GetValue("Form1.AutoScroll", typeof(bool))));
- this.CausesValidation = ((bool)(configurationAppSettings.GetValue("Form1.CausesValidation", typeof(bool))));
- this.ClientSize = new System.Drawing.Size(648, 337);
- this.ControlBox = ((bool)(configurationAppSettings.GetValue("Form1.ControlBox", typeof(bool))));
- this.Controls.Add(this.vSBar);
- this.Controls.Add(this.hSBar);
- this.Controls.Add(this.tabControl1);
- this.Controls.Add(this.statusBar1);
- this.Controls.Add(this.tbMain);
- this.HelpButton = ((bool)(configurationAppSettings.GetValue("Form1.HelpButton", typeof(bool))));
- this.KeyPreview = true;
- this.Menu = this.mainMenu1;
- this.Name = "frmMain";
- this.Text = "TCADClient Test APP";
- this.ResumeLayout(false);
-
- }
- #endregion
-
- /// <summary>
- /// The main entry point for the application.
- /// </summary>
- [STAThread]
- static void Main()
- {
-
- Application.Run(new frmMain());
-
- }
-
- private void mnuOpenFile_Click(object sender, System.EventArgs e)
- {
- statusBar1.Text = "";
- tcApp.OpenDrawing(tabControl1);
- if (tcApp.gxDrawing != null)
- {
- statusBar1.Text = tcApp.gxDrawing.Name;
- }
- ControlsEnabler();
- tabControl1.Refresh ();
- if (tcApp.gxView != null)
- {
- tcApp.gxView.ZoomToExtents ();
- }
- }
-
- public TabPage GetCurrentTab()
- {
- TabPage tabPage1;
- System.Collections.IEnumerator pN;
- pN = tabControl1.TabPages.GetEnumerator ();
- pN.MoveNext() ;
- tabPage1 = (TabPage) pN.Current;
- return tabPage1;
- }
- protected override void OnResize(EventArgs e)
- {
-
- // TODO: Add Form1.OnResize implementation
- MyResize();
- base.OnResize (e);
- }
-
- public void MyResize()
- {
- tabControl1.Top = tbMain.Height;
- tabControl1.Left = tbMain.Left;
- tabControl1.Width = base.Size.Width - vSBar.Width - 10 ; //this.Width;
- tabControl1.Height = base.Height - tbMain.Height - statusBar1.Height-hSBar.Height - 40;
- vSBar.Left = tabControl1.Left + tabControl1.Width ;
- vSBar.Top = tabControl1.Top ;
- vSBar.Height = tabControl1.Height - hSBar.Height ;
- hSBar.Left = tbMain.Left + tabControl1.Width/2;
- hSBar.Top = tbMain.Height + tabControl1.Height - hSBar.Height;
- hSBar.Width = tabControl1.Width/2 ;
- if (tcApp != null)
- {
- if (tcApp.gxView != null)
- {
- tcApp.gxView.AutoRedraw = false;
- tcApp.gxView.ScreenWidth = tabControl1.SelectedTab.Width;
- tcApp.gxView.ScreenHeight = tabControl1.SelectedTab.Height ;
- tcApp.gxView.AutoRedraw = true;
- tcApp.gxView.Refresh ();
-
- }
- }
- }
-
- private void mnu_Refresh_Click(object sender, System.EventArgs e)
- {
- //tabControl1.Refresh ();
- tcApp.gxView.Refresh ();
- }
-
- private void mnu_ZoomToExtents_Click(object sender, System.EventArgs e)
- {
- vSBar.Value = (vSBar.Maximum - vSBar.Minimum )/2;
- hSBar.Value = (hSBar.Maximum - hSBar.Minimum )/2;
- tcApp.gxView.Update = false;
- tcApp.gxView.ZoomToExtents ();
- tabControl1.Refresh ();
- tcApp.gxView.Update = true;
- }
-
- private void button3_Click(object sender, System.EventArgs e)
- {
- tcApp.OpenDrawing(tabControl1);
- tabControl1.Refresh ();
- }
-
- private void tabControl1_SelectedIndexChanged(object sender, System.EventArgs e)
- {
- TabPage tp;
- object spName = "";
- object oSpaceModePropName = "TileMode";
- object oSpaceMode = 0;
- bool bPaperSpace = false;
- tp = tabControl1.SelectedTab ;
- if (tp == null)
- {
- return;
- }
- IMSIGX.Property pProp = null;
- GXMPSLib.PaperSpaces pss = null;
- GXMPSLib.PaperSpace ps = null;
-
- spName = tp.Text;
- if (tcApp == null)
- {
- return;
- }
- if (tcApp.gxDrawing == null)
- {
- return;
- }
- if (spName.Equals("Model") == false)
- {
- pss = (PaperSpaces) tcApp.gxDrawing.PaperSpaces;
- ps = pss.get_Item(ref spName);
- oSpaceMode = IMSIGX.ImsiSpaceModeType.imsiPaperSpace;
- bPaperSpace = true;///pProp = tcApp.gxDrawing.Properties.get_Item(ref oSpaceModePropName);
-
- }
- else
- {
- if (tcApp != null)
- {
- if (tcApp.gxView !=null)
- {
- oSpaceMode = IMSIGX.ImsiSpaceModeType.imsiModelSpace;
- }
- }
- }
-
- pProp = tcApp.gxDrawing.Properties.get_Item(ref oSpaceModePropName);
- if (pProp != null)
- {
- pProp.set_Value (0, ref oSpaceMode);
-
-
- }
- if (tcApp.gxView != null)
- {
- tcApp.gxView.SpaceMode = (IMSIGX.ImsiSpaceModeType)oSpaceMode ;
- }
-
- if (bPaperSpace && ps != null)
- {
- ps.Activate ();
- }
- tbMain.Enabled = (!bPaperSpace && true);
- mnu_Camera.Enabled = (!bPaperSpace && true);
- if (tcApp != null)
- {
- if (tcApp.gxView !=null)
- {
- tcApp.gxView.AutoRedraw = false;
- tcApp.gxView.Update = false;
- tcApp.gxView.Delete ();
-
- tcApp.AddView ((int)tp.Handle );
- tcApp.gxView.AutoRedraw = false;
-
-
- tcApp.gxView.Update = true;
- tcApp.gxView.MappingMode = 1;
- tcApp.gxView.FixedAspectRatio = true;
-
- tabControl1.Visible = false;
- tabControl1.Refresh ();
- tabControl1.Visible = true;
- tcApp.gxView.AutoRedraw = true;
- tcApp.gxView.ZoomToExtents ();
- vSBar.Value = (vSBar.Maximum - vSBar.Minimum )/2;
- hSBar.Value = (hSBar.Maximum - hSBar.Minimum )/2;
-
- }
- }
-
- }
-
- private void mnuCameraISO_SE_Click(object sender, System.EventArgs e)
- {
- if (tcApp != null)
- {
- if (tcApp.gxView !=null)
- {
- if (tcApp.gxView.SpaceMode == 0 )
- {
- return; // do nothing if paper space
- }
- tcApp.SetView (tcApp.gxView, 5);
- vSBar.Value = (vSBar.Maximum - vSBar.Minimum )/2;
- hSBar.Value = (hSBar.Maximum - hSBar.Minimum )/2;
- tabControl1.Refresh ();
- tcApp.gxView.Refresh ();
- }
- }
- }
-
- private void tbMain_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
- {
- int iindex = 0;
- if (tcApp != null)
- {
- if (tcApp.gxView !=null)
- {
- iindex = e.Button.ImageIndex ;
- vSBar.Value = (vSBar.Maximum - vSBar.Minimum )/2;
- hSBar.Value = (hSBar.Maximum - hSBar.Minimum )/2;
- tcApp.SetView (tcApp.gxView , iindex);
-
- tabControl1.Refresh ();
- tcApp.gxView.Refresh ();
- }
- }
-
-
- }
-
- private void mnu_FileExit_Click(object sender, System.EventArgs e)
- {
- this.Dispose (true);
- }
-
- private void mnuZoomIn_Click(object sender, System.EventArgs e)
- {
- if (tcApp != null)
- {
- if (tcApp.gxView !=null)
- {
- tcApp.Zoom (tcApp.gxView, 0.8);
- tabControl1.Refresh ();
- tcApp.gxView.Update = true;
- }
- }
- }
-
- private void mnuZoomOut_Click(object sender, System.EventArgs e)
- {
- if (tcApp != null)
- {
- if (tcApp.gxView !=null)
- {
- tcApp.Zoom (tcApp.gxView, 1.2);
- tabControl1.Refresh ();
- tcApp.gxView.Update = true;
- }
- }
-
- }
-
-
-
-
- protected override void OnMouseWheel(MouseEventArgs e)
- {
- // TODO: Add Form1.OnMouseWheel implementation
- if (tcApp != null)
- {
- if (tcApp.gxView !=null)
- {
- if (e.Delta > 0)
- {
- tcApp.Zoom (tcApp.gxView, 0.8);
- }
- else
- {
- tcApp.Zoom (tcApp.gxView, 1.2);
- }
- tabControl1.Refresh ();
- tcApp.gxView.Update = true;
- }
- }
- base.OnMouseWheel (e);
- }
-
- protected override void OnKeyPress(KeyPressEventArgs e)
- {
- char eKey;
- eKey = e.KeyChar;
- // TODO: Add Form1.OnKeyPress implementation
- if (tcApp != null)
- {
- if (tcApp.gxView !=null)
- {
- switch(e.KeyChar )
- {
- case ((char)43)://'+': // zoom In
- tcApp.Zoom (tcApp.gxView, 0.8);
- break;
- case ((char)45)://'-': // Zoom Out
- tcApp.Zoom (tcApp.gxView, 1.2);
- break;
- case ((char) 40):
- default:
- break;
- }
- tabControl1.Refresh ();
- tcApp.gxView.Update = true;
- }
- }
- base.OnKeyPress (e);
- }
-
- public void ControlsEnabler()
- {
- bool bScrollBarsVisible = false;
- if (tcApp != null)
- {
- if (tcApp.gxView !=null)
- {
- bScrollBarsVisible = true;
- }
- }
- hSBar.Visible = bScrollBarsVisible;
- vSBar.Visible = bScrollBarsVisible;
-
- }
-
- private void hSBar_Scroll(object sender, System.Windows.Forms.ScrollEventArgs e)
- {
- if (tcApp != null)
- {
- if (tcApp.gxView !=null)
- {
- UpdateHScroll();
- }
- }
- }
-
- public void UpdateHScroll()
- {
- long ScrollVal;
- ScrollVal = hSBar.Value;
- if (ScrollVal != tcApp.ScrollLast.x )
- {
- double Range;
- double Delta;
- Range = hSBar.Maximum - hSBar.Minimum;
- Delta = ScrollVal - tcApp.ScrollLast.x;
- if (Delta == Range/2)
- {
- Delta = 0;
- }
- Delta = Delta * 0.1;
- tcApp.gxView.Update = false;
- tcApp.ViewScrollBy (Delta, 0);
- tabControl1.Refresh();
- tcApp.gxView.Update = true;
- }
- tcApp.ScrollLast.x = ScrollVal; //Remember last value
- }
-
- public void UpdateVScroll()
- {
- long ScrollVal;
- ScrollVal = vSBar.Value;
- if (ScrollVal != tcApp.ScrollLast.y)
- {
- double Range;
- double Delta;
- Range = vSBar.Maximum - vSBar.Minimum;
- Delta = ScrollVal - tcApp.ScrollLast.y;
- if (Delta == Range/2)
- {
- Delta = 0;
- }
- Delta = -Delta * 0.1;
- tcApp.gxView.Update = false;
- tcApp.ViewScrollBy(0, Delta);
- tabControl1.Refresh();
- tcApp.gxView.Update = true;
- }
- tcApp.ScrollLast.y = ScrollVal; //Remember last value
- }
-
- private void vSBar_Scroll(object sender, System.Windows.Forms.ScrollEventArgs e)
- {
- UpdateVScroll();
- }
-
- private void mnu_CameraProperties_Click(object sender, System.EventArgs e)
- {
- MessageBox.Show ("Add your code here");
- }
-
-
- protected override void OnPaint(PaintEventArgs e)
- {
- // TODO: Add Form1.OnPaint implementation
- tabControl1.Invalidate();
- base.OnPaint (e);
- }
- }
- }
-